import { GTileList } from "../../../../com/mui/controls/GTileList";
import { ScrollBarDirection } from "../../../../fl/controls/ScrollBarDirection";
import { PropsRender } from "./PropsRender";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { ShopItemInfo } from "../../resource/info/ShopItemInfo";
import { Cache } from "../../cache/Cache";
import { EPrictUnit } from "../../../../Message/Public/EPrictUnit";
import { DataEvent } from "../../events/DataEvent";
import { ShopMallEventName } from "./ShopMallEventName";
import { ShopInfo } from "../../resource/info/ShopInfo";
type int = number;
//class PropsListPanel
    
    export  class PropsListPanel extends GTileList
    {
        constructor()
        {
            super();
            this.mouseChildren = true;
            this.initTile();
            return;
        }

        /* internal  */initTile(): void
        {
            this.setSize(430, 340);
            this.columnWidth = 197;
            this.rowHeight = 77;
            this.direction = ScrollBarDirection.VERTICAL;
            this.horizontalGap = 5;
            this.verticalGap = 8;
            this.setStyle("skin", new Object /* flash.display.Bitmap */());
            this.setStyle("cellRenderer", PropsRender);
            return;
        }

        public updateProvider(arg1: Array<any>): void
        {
            var loc2=null;
            var loc3=0;
            var loc1=new DataProvider();
            if (null != arg1) 
            {
                loc3 = 0;
                while (loc3 < arg1.length) 
                {
                    loc2 = arg1[loc3] as ShopItemInfo;
                    loc2.buyNum = 1;
                    if (Cache.instance.shop.isGuid && loc3 == 0) 
                    {
                        loc1.addItem({"shopItemInfo": loc2, "isHighlight": true});
                        Cache.instance.shop.isGuid = false;
                    }
                    else 
                    {
                        loc1.addItem({"shopItemInfo": loc2, "isHighlight": false});
                    }
                    ++loc3;
                }
            }
            this.dataProvider = loc1;
            if (this._shopInfo.unit != EPrictUnit._EPriceUnitPoint) 
            {
                this.dispatchEvent(new DataEvent(ShopMallEventName.SHOW_POINT_SHOP, false, false, true));
            }
            else 
            {
                this.dispatchEvent(new DataEvent(ShopMallEventName.SHOW_POINT_SHOP, true, false, true));
            }
            return;
        }

        public setLayout(arg1: int): void
        {
            if (arg1 != 0) 
            {
                if (arg1 == 1) 
                {
                    this.setSize(635, 340);
                    this.columnWidth = 210;
                    PropsRender.isWider = true;
                }
            }
            else 
            {
                this.setSize(430, 340);
                this.columnWidth = 200;
                PropsRender.isWider = false;
            }
            return;
        }

        public get shopInfo(): ShopInfo
        {
            return this._shopInfo;
        }

        public set shopInfo(arg1: ShopInfo)
        {
            this._shopInfo = arg1;
            return;
        }

        /* internal */ /* var */_shopInfo: ShopInfo;
    }
